package com.dnw.shyfunny;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.dnw.base.BaseActivity;
import com.dnw.base.BasePresenter;

import com.dnw.searchview.ICallBack;
import com.dnw.searchview.SearchView;
import com.dnw.searchview.bCallBack;
import com.dnw.util.UIUtils;


import butterknife.Bind;
import butterknife.OnClick;
import flyn.Eyes;


public class SearchActivity extends BaseActivity {
    @Bind(R.id.tv_author)
    TextView tvAuthor;
    @Bind(R.id.search_view)
    SearchView searchView;

    RecyclerView id_recyclerview;

    @Override
    public void initView() {
        Eyes.setStatusBarColor(this, UIUtils.getColor(R.color.a));
        // 3. 绑定组件
//        searchView = (SearchView) findViewById(R.id.search_view);
    }

    @Override
    public void initData() {
        tvAuthor.setText(getResources().getString(R.string.action_settings));


// 4. 设置点击搜索按键后的操作（通过回调接口）
        // 参数 = 搜索框输入的内容
        searchView.setOnClickSearch(new ICallBack() {
            @Override
            public void SearchAciton(String searchKey) {
                if(searchKey.isEmpty()){
                    UIUtils.showToast("清除成功~~");
                    return;
                }else if(searchKey.equalsIgnoreCase("羞羞的推荐")){
                    startActivity(new Intent(SearchActivity.this, ProgramActivity.class));
                } else {
                    startActivity(new Intent(SearchActivity.this, SearchDetailActivity.class)
                            .putExtra("searchKey", searchKey));
                }
            }
        });

        // 5. 设置点击返回按键后的操作（通过回调接口）
        searchView.setOnClickBack(new bCallBack() {
            @Override
            public void BackAciton() {
                finish();
            }
        });
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_search;
    }

    @OnClick(R.id.tv_back)
    public void onViewClicked() {
        finish();
    }
}
